home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 2 / CU Amiga Magazine's Super CD-ROM 02 (1996)(EMAP Images)(GB)[!][issue 1996-04].iso / magazine / amiga_e / amigae.july.archive / 000020_crash!kirk.safb.af.mil!BWILLS_Sun, 11 Jul 93 09:40:51 PST.msg < prev    next >
Text File  |  1993-08-31  |  3KB  |  116 lines

  1. Received: by bkhouse.cts.com (V1.16/Amiga)
  2.     id AA00000; Sun, 11 Jul 93 09:40:51 PST
  3. Received: from kirk.safb.af.mil by crash.cts.com with smtp
  4.     (Smail3.1.28.1 #15) id m0oF2pk-00016tC; Sun, 11 Jul 93 07:56 PDT
  5. Message-Id: <m0oF2pk-00016tC@crash.cts.com>
  6. Date: 11 Jul 93 09:52:00 CST
  7. From: "Barry D. Wills" <BWILLS@kirk.safb.af.mil>
  8. To: "amigae" <amigae@bkhouse.cts.com>
  9. Subject: Processor Ids
  10.  
  11. Here's something I cooked up to help my startup-sequence in deciding which
  12. startup to run based on the processor I booted with (Derringer-030 uses 68000
  13. and 68030).  It also checks for FPU and MMU just for the heck of it.
  14. ----- CUT HERE ----------------------------------------------------------------
  15. /*
  16.   IdentifyProcessors - For AmigaDOS V1.3 (and higher?)
  17.   Author:  Barry Wills
  18.  
  19.   Program to place the values of the current processor ids in the
  20.   environment.  The following environment variables will receive the
  21.   appropriate string values, and can be used in scripts:
  22.  
  23.   $CPU - 68040
  24.          68030
  25.          68020
  26.          68010
  27.          68000
  28.   $FPU - 68882
  29.          68881
  30.          NIL     (usage:  IF "$FPU" eq "")
  31.   $MMU - 68851
  32.          NIL     (usage:  IF "$MMU" eq "")
  33.  
  34.  
  35.   Configuration Notes (add your config and results here)
  36.   ~~~~~~~~~~~~~~~~~~~
  37.   KS1.3: - 68000/""/""       == correct values reflected
  38.            68030/68881/68851 == (Derringer-030)  MMU not recognized
  39.  
  40.  
  41.   Rights and Restrictions
  42.   ~~~~~~~~~~~~~~~~~~~~~~~
  43.   This program is hereby placed in the public domain.  The reader/user of
  44.   this program assumes all risk.
  45.  
  46. */
  47.  
  48.  
  49. MODULE 'exec/types'
  50. MODULE 'exec/execbase'
  51. MODULE 'dos/dos'
  52.  
  53. DEF ver = NIL
  54.  
  55. PROC main ()
  56.   DEF execBase : PTR TO execbase,
  57.       attnFlag,
  58.       processor,
  59.       fh
  60.  
  61.    ver := 'VER$: PROCs V1.0 (10JUL93)'
  62.  
  63.    execBase := execbase
  64.    attnFlag := execBase.attnflags
  65.  
  66.    /*-----------------*/
  67.    /* Check CPU type. */
  68.    /*-----------------*/
  69.  
  70.    IF attnFlag AND AFF_68040
  71.      processor := '68040'
  72.    ELSEIF attnFlag AND AFF_68030
  73.      processor := '68030'
  74.    ELSEIF attnFlag AND AFF_68020
  75.      processor := '68020'
  76.    ELSEIF attnFlag AND AFF_68010
  77.      processor := '68010'
  78.    ELSE
  79.      processor := '68000'
  80.    ENDIF
  81.  
  82.    IF (fh := Open ('ENV:CPU', NEWFILE)) = NIL THEN RETURN RETURN_FAIL
  83.    Write (fh, processor, 5)
  84.    Close (fh)
  85.  
  86.    /*----------------*/
  87.    /* Check for FPU. */
  88.    /*----------------*/
  89.  
  90.    IF attnFlag AND AFF_68881
  91.      processor := '68881'
  92.    ELSEIF attnFlag AND AFF_68882
  93.      processor := '68882'
  94.    ELSE
  95.      processor := NIL
  96.    ENDIF
  97.  
  98.    IF (fh := Open ('ENV:FPU', NEWFILE)) = NIL THEN RETURN RETURN_FAIL
  99.    IF processor THEN Write(fh, processor, 5)
  100.    Close (fh)
  101.  
  102.    /*----------------*/
  103.    /* Check for MMU. */
  104.    /*----------------*/
  105.  
  106.    IF attnFlag AND AFF_68851_MMU
  107.      processor := '68851'
  108.    ELSE
  109.      processor := NIL
  110.    ENDIF
  111.  
  112.    IF (fh := Open ('ENV:MMU', NEWFILE)) = NIL THEN RETURN RETURN_FAIL
  113.    IF processor THEN Write (fh, processor, 5)
  114.    Close (fh)
  115.  
  116. ENDPROC  0